<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
<script src="../public/libs/jquery.min.js"></script>
<script src="../public/plugins/echars/echarts.min.js"></script>
    <script type="text/javascript" >
        $(function () {
            var myChart = echarts.init(document.getElementById('myecharts'));

            option = {
                title: {
                    text: '各部门男女员工统计',
                    subtext: '饼状图',
                    left: 'center'
                },
                tooltip: {
                    trigger: 'item',
                    formatter: '{a} <br/>{b} : {c} ({d}%)'
                },
                legend: {
                    orient: 'vertical',
                    left: 'left',
                    data: []
                },
                series: [
                    {
                        name: '访问来源',
                        type: 'pie',
                        radius: '55%',
                        center: ['50%', '60%'],
                        data: [],
                        emphasis: {
                            itemStyle: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            }
                        }
                    }
                ]
            };


            $.get({
                url:"/sys/pieecharts",
                dataType:"json",
                success:function (r) {
                    option.legend.data=r.deptNameList;
                    option.series[0].data=r.pieData;

                    myChart.setOption(option);
                }
            })

            // myChart.setOption(option);

        })


    </script>

</head>
<body>

<div style="width: 600px;height: 500px" id="myecharts"></div>

</body>
</html>